package com.nwpu.coursesupport.controller;


import com.nwpu.coursesupport.entity.bean.Response;
import com.nwpu.coursesupport.entity.params.FinalExamTaskSubmit.FinalExamTaskSubmitParam;
import com.nwpu.coursesupport.entity.params.correctTask.FinalTaskParam;
import com.nwpu.coursesupport.service.imple.FinalExamTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author shun
 * @email ws2017303035@mail.nwpu.edu.cn
 * @date 2020-08-04 21:33:50
 */
@RestController
@RequestMapping("/finalExamTask")
public class FinalExamTaskController {
    @Autowired
    private FinalExamTaskService finalExamTaskService;

    @RequestMapping("/submit")
    public Response submitFinalExamTask(@RequestBody List<FinalExamTaskSubmitParam> finalExamTaskSubmitParamList) {
        System.out.println("data::::" + finalExamTaskSubmitParamList);
        return finalExamTaskService.submitFinalExamTask(finalExamTaskSubmitParamList);

    }

    @RequestMapping("/get/{courseId}")
    public Response getFinalExamTask(@PathVariable Integer courseId) {
        return finalExamTaskService.getFinalExamTask(courseId);
    }

    @RequestMapping("/selectStudent/{courseId}")
    public Response selectStudent(@PathVariable Integer courseId) {
        return finalExamTaskService.selectStudent(courseId);
    }

    @RequestMapping("/getStudentSubmitScore/{studentCode}")
    public Response getStudentSubmitScore(@PathVariable String studentCode) throws Exception {
        return finalExamTaskService.getStudentSubmitScore(studentCode);

    }

    @RequestMapping("/submitStudentScore")
    public Response submitStudentScore(@RequestBody FinalTaskParam finalTaskParam) {
        return finalExamTaskService.submitStudentScore(finalTaskParam);
    }
}
